package com.iweb.service;

import com.iweb.mapper.UCMotionMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * Time :2022/8/16 19:58
 * Author : kriller
 * Project : steam-malls
 */
@Service
public class UserCommentMotionService {

    @Resource
    private UCMotionMapper ucMotionMapper;

    public Integer findMotion(Integer userId, Integer commentId) {
        Map<String,Integer> map = new HashMap<>();
        map.put("userId",userId);
        map.put("commentId",commentId);
        Integer motion = ucMotionMapper.selectMotion(map);
        return motion;
    }

    public void newMotion(Integer userId, Integer commentId, Integer newMotion) {
        Map<String,Integer> map = new HashMap<>();
        map.put("userId",userId);
        map.put("commentId",commentId);
        map.put("newMotion",newMotion);
        ucMotionMapper.insertNewMotion(map);
    }

    public void setNewMotion(Integer userId, Integer commentId, Integer newMotion) {
        Map<String,Integer> map = new HashMap<>();
        map.put("userId",userId);
        map.put("commentId",commentId);
        map.put("newMotion",newMotion);
        ucMotionMapper.updateNewMotion(map);
    }
}
